#!/usr/bin/python3

import sys
from urllib.parse import parse_qs

data = sys.stdin.read()
post_data = parse_qs(data)

username = post_data['username'][0]
password = post_data['password'][0]

if username == 'alice' and password == 'abc':
    print('Set-Cookie: ticket=1234')
    print('Status: 302')
    print('Location: /cgi/inbox')

print('Content-Type: text/plain\n\n', end='')
